<?php

class News_model extends MY_Model{

	public function __construct(){
		parent::__construct();
		$this->table = 'alsa_news';
		
		$this->as = 'n';
		
		$this->relations = array(
		    array(
			'table' => 'alsa_node',
			'as' => 'nh',
			'foreign' => 'id',
			'local' => 'home_cover',
			'type' => 'left'
		    ),
		    array(
			'table' => 'alsa_node',
			'as' => 'nl',
			'foreign' => 'id',
			'local' => 'list_cover',
			'type' => 'left'
		    ),
		    array(
			'table' => 'alsa_news_category',
			'as' => 'nc',
			'foreign' => 'id',
			'local' => 'category',
			'type' => 'left'
		    )
		);
		
		$this->columns = array(
		    '*',
		    array('nc.name_zh','category_name'),
		    array('nh.name','home_cover_name'),
		    array('nl.name','list_cover_name')
		);
	}

}
